<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>  
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport"
    content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/jquery-easyui/themes/default/easyui.css"/>">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/jquery-easyui/themes/icon.css"/>">
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/jquery-1.6.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.panel.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.datagrid.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.messager.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/ext-for-framework.js.jsp"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/locale/easyui-lang-zh_CN.js"/>"></script>
<script type="text/javascript"
			src="<c:url value="/static/js/common.js"/>"></script>		
<script type="text/javascript">
	function initList(listDisplayEId) {
		$('#' + listDisplayEId).datagrid(
				{
					nowrap : false,
					striped : true,
					collapsible : true,
					remoteSort : true,
					notSelectByRow : false,
					onLoadError : function() {
						$.messager.alert('错误', '获取数据失败，请与管理员联系！', 'error');
					},
					onClickRow : function(rowIndex) {
						$(".myrad").prop("checked", false);
						$(".myrad").eq(rowIndex).prop("checked", true);
					}
				});

	};
	$(document).ready(function() {
		initList('listDisplay');
	});
	//下拉框
	$(function() {        
         
    }); 
	function searchInfo(){
		if($('#ordDate').datebox('getValue') == ''){
			$.messager.alert('提示', '请填写订单日期！', 'info');
			return false;
		}
		if($('#materId').val()=='' && $('#materName').val()==''){
			$.messager.alert('提示', '材料id和材料名至少填写1个！', 'info');
            return false;
		}
		
		var materIdval = 0 ;
		if($('#materId').val()!=''){
			materIdval = $('#materId').val();
		}
		
		$('#listDisplay').datagrid('load', {
			initFlag : 1,
			ordDate : $('#ordDate').datebox('getValue'),
			materId : materIdval,
	        materName : $('#materName').val()

		}); 
		
	}
	
	function cellStyler(value, row, index) {
        if (row['leaveMessage'] != '') {
            return 'background-color:green;';
        }
    }
</script>
</head>

<body>
	<table>
		<tr>
		    <td>
			<div style="height: auto; width:100%;background: #fafafa; padding: 5px;" class="easyui-panel" title="查询" iconCls="icon-search" collapsible="true" minimizable="false" maximizable="false" closable="false">
					<form id="searchForm" name="searchForm" method="post"
						action="userlist.txt"
						onsubmit="return searchDGData(this.id,'listDisplay');">
						<div>
		            	<table cellpadding="5">
								<tr>
									<td>材料id:</td>
									<td><input class="easyui-validatebox" id="materId"  name="materId"></input></td>
								</tr>
								<tr>
                                    <td>材料名称:</td>
                                    <td><input class="easyui-validatebox" id="materName"  name="materName"></input></td>
                                </tr>
								<tr>
									<td>订单日期：</td>
									<td><input class="easyui-datebox" editable="false" id="ordDate" name="ordDate"></input></td>
		                    	</tr>
		                    	<tr>
		                    	    <td><input type="button" onclick="searchInfo()" value="查询"></td>
		                    	</tr>
		                    	
		                </table>					 
						</div>
					</form>
				</div>
			</td>
		</tr>
		<tr><td>
	<table id="listDisplay" title="订单材料列表" singleSelect=true width="100%"
		iconCls="icon-list" idField="id"
		url="<c:url value="/supplierDistribute/findDistributeMater.do"/>"
		loadMsg="请稍候......"
		pagination="false" sortName="roleId"
		rownumbers="false" sortOrder="asc" showFooter="true">
		<thead>
				<tr>
				    <th field="id" width="25" align="center"  checkbox="true" hidden="true">
					</th> 
				    <th field="materId" width="80"  sortable="true" hidden="true"  styler="cellStyler">
						材料id
					</th>	
 					<th field="materName" width="60" sortable="true"  styler="cellStyler">
						材料名
					</th>	
					<th field="brands" width="40" sortable="true"  styler="cellStyler">品牌
                    </th>   
					<th field="specifications" width="60" sortable="true"  styler="cellStyler">规格
                    </th>   
					<th field="shopId" width="80" sortable="true" hidden="true">
						客户id
					</th>	
					<th field="shopName" width="80"  sortable="true"  styler="cellStyler">
						客户名
					</th>	
					<th field="ordMaterWeight" width="40"  sortable="true"  styler="cellStyler">数量
                    </th>   
                    <th field="unit" width="40" sortable="true"  styler="cellStyler">单位
                    </th>
                    <th field="leaveMessage" width="80" sortable="true"  styler="cellStyler">留言
                    </th>   
					
 				</tr>
		</thead>
	</table>
	</td>
	</tr>
	</table>
</body>
<style>
body{margin:0;padding:0;}
.m-toolbar{
    position: relative;
    text-align: center;
    min-height: 32px;
    background-color:#e0edfe ;
}
.datagrid-row {
    height: 32px;
}

</style>
</html>